1. Field of the Invention
This invention relates generally to a method of and apparatus for measuring a speed of a vehicle in accordance with pulses generated by a vehicle speed sensor which is rotated in response to a movement of the vehicle, and more particularly to a method and an apparatus which is prepared to employ any one of a plurality of different types of vehicle speed sensors which produce different numbers of pulses for one full rotation thereof.
2. Description of the Prior Art
Digital vehicle speed measuring apparatus are conventionally known which record data of a movement of a vehicle including, for example, vehicle speed information in the form of a digital signal into a record medium. An exemplary one of such conventional digital vehicle speed measuring apparatus is shown in FIG. 7. Referring to FIG. 7, the conventional digital vehicle speed measuring apparatus shown includes a vehicle speed sensor 1 which may produce 4, 8, 10, 16, 20 or 25 pulses for one full rotation thereof depending upon a type thereof. The digital vehicle speed measuring apparatus further includes an interface (IF) 2 which shapes pulses generated by the vehicle speed sensor 1, a microcomputer (CPU=central processing unit) 3 which operates in accordance with a predetermined control program, a setting device 4 for setting a type of the vehicle speed sensor 1 by way of a combination of presence or absence of jumper lines, a display driver 5 for causing a digital display unit 6 to display thereon a vehicle speed transmitted from the CPU 3 which measures such vehicle speed in accordance with pulses from the vehicle speed sensor 1 and a set value from the setting device 4, and an external memory 7 for storing therein digital data representative of a vehicle speed measured by the CPU 3.
With the conventional digital vehicle speed measuring apparatus of the construction described above, the CPU 3 determines the type of the vehicle speed sensor 1 from a set value received from the setting device 4, and where the vehicle speed sensor 1 connected is of a type which produces 4, 8 or 10 pulses for one full rotation, the CPU 3 measures a period of a pulse and calculates a vehicle speed by calculation. On the other hand, where the vehicle speed sensor 1 connected is of another type which produces 16, 20 or 25 pulses for one full rotation, the CPU 3 sets a gate time in accordance with such pulse number of the sensor and measures a number of pulses which is produced by the vehicle speed sensor 1 for such gate time, and then calculates a vehicle speed from the number of pulses thus measured.
In order to perform such operation, the CPU 3 executes such jobs as illustrated in a flow chart of FIG. 8. Referring to FIG. 8, the CPU 3 starts its operation when power is made available, and at first step S1 of the operation, the CPU 3 receives a set value from the setting device 4. Then at step S2, the set value thus received is checked to judge whether or not the vehicle speed sensor 1 is of a type which produces 4, 8 or 10 pulses for one rotation. If the judgment is YES and the vehicle speed sensor 1 connected is of the type which produces 4, 8 or 10 pulses for one rotation, then a flag is set to "1" at step S3, but on the contrary if the judgment at step S2 is NO and the vehicle speed sensor 1 connected is of another type which produces 16, 20 or 25 pulses for one rotation, the flag is set to "0" at step S4, and then a gate time is set at step S5 in accordance with the type of the vehicle speed sensor 1 connected. After execution of the job at either of the steps S3 and S5, the control sequence advances to step S6 at which it is judged whether or not the flag is equal to "1".
If the judgment at step S6 is YES, then the control sequence advances to step S7 at which the CPU 3 waits a pulse to be received from the vehicle speed sensor 1 by way of the interface 2. After a pulse is received and the judgment at step S7 changes to YES, the control sequence advances to step S8 at which the count value of a free running counter which is constructed in the CPU 3 and incremented after lapse of each fixed interval of time by a clock of a fixed period is set as a capture value to a capture register also constructed in the CPU 3, whereafter the control sequence advances to step S9. At step S9, it is judged from the set value received at step S1 and representative of a type of the vehicle speed sensor 1 whether or not the vehicle speed sensor 1 is of the type which produces 4 pulses for one rotation. In case the judgment at step S9 is YES, the control sequence advances to step S10.
At step S10, contents of second to fifth ones T.sub.2 to T.sub.5 of eleven time registers T.sub.1 to T.sub.11 constructed in the CPU 3 are transferred to the first to fourth time registers T.sub.1 to T.sub.4, respectively, and at subsequent step S11, the capture value placed into the capture register at step S8 is transferred to the fifth time register T.sub.5. After then, the control sequence advances to step S12 at which a difference between contents of the first time register T.sub.1 and contents of the fifth time register T.sub.5, that is, T=T.sub.5 -T.sub.1, is taken to calculate a period T for one rotation of the vehicle speed sensor 1. After such calculation of a period T for one rotation of the vehicle speed sensor 1 at step S12, the control sequence advances to step S13 at which a vehicle speed is calculated by dividing a travel distance A of the vehicle for one rotation of the vehicle speed sensor 1 by the period T. Data calculated in this manner and indicative of a vehicle speed are inputted to the display driver (step S51), and consequently, such vehicle speed is displayed on the display unit 6. In addition, the data are also outputted to the external memory (step S52) so that they may be stored into the external memory 7.
In case the judgment at step S9 is NO, the control sequence advances to step S14 at which it is judged whether or not the vehicle speed sensor 1 is of the type which produces 8 pulses for one rotation. If the judgement is YES, then a period T is calculated at steps S15 to S17 in accordance with a similar algorism to that at steps S10 to S12 described hereinabove. After then, a vehicle speed is calculated at step S13 making use of the period T calculated in this manner. On the contrary if the judgment at step S14 is NO, it is determined that the vehicle speed sensor is of the type which produces 10 pulses for one rotation, and a period T is calculated subsequently at steps S18 to S20 in accordance with a similar algorism. After then, a vehicle speed is calculated at step S13 making use of the period T calculated in this manner.
On the other hand, in case the judgment at step S6 is NO and the vehicle speed sensor 1 connected is of any type which produces a number of pulses other than 4, 8 and 10 pulses for one rotation, the control sequence advances to step S21 at which the CPU 3 waits a pulse to be received from the vehicle speed sensor 1 by way of the interface 2. After a pulse is received and the judgment at step S21 changes to YES, the control sequence advances to step S22 at which a pulse counter constructed in the CPU 3 is incremented. After then, at step S23, it is judged whether or not the gate time set at step S5 has elapsed, and if the gate time has not yet elapsed, the control sequence returns to step S21 to repeat the jobs at step S21 and so forth. On the other hand, if the gate time has elapsed and the judgment at step S23 is YES, then the control sequence advances to step S24 at which a vehicle speed is calculated making use of the gate time, the count value of the pulse counter and so forth. Then at step S25, the count value of the pulse counter is cleared, whereafter the control sequence returns to step S21.
As described above, in the conventional digital vehicle speed measuring apparatus, where a vehicle speed sensor which produces 4, 8 or 10 pulses for one rotation is employed, a time necessary for the vehicle speed sensor to make one rotation, that is, a period, is measured, and then a vehicle speed is found out by calculation in accordance with the measured thus calculated. On the other hand, where another vehicle speed sensor which produces 16, 20 or 25 pulses for one rotation is employed, a number of pulses produced by the vehicle speed sensor for a gate time set in accordance with the type of the vehicle speed sensor is counted, and a vehicle speed is found out by calculation in accordance with the gate time, count value and so forth.
Consequently, since means for calculating a vehicle speed must be provided separately for different types of vehicle speed sensors as described hereinabove with reference to the flow chart of FIG. 8 and such calculating means cannot be used commonly for such different vehicle speed sensors, the conventional digital vehicle speed measuring apparatus is complicated in construction. Where a CPU which operates in accordance with a control program is employed as in the case of the conventional digital vehicle speed measuring apparatus described above, the control program involves a great number of steps for such calculation and a ROM (read only memory) for storing the control program therein must have a corresponding great storage capacity. Also, a RAM (random access memory) which is used as a working area must have a corresponding great storage capacity.
Further, since the gate time system is employed, where a high degree of accuracy of, for example, 0.1 km/h is required, the gate time is excessively long, and consequently, the responsibility is low. As a result, the digital vehicle speed measuring apparatus cannot be employed where such high accuracy is required.